<template>
  <div>
    <div class="main">
 
      <eagle-date
        label="最近复审日期"
        required
        :date.sync="form.CheckDay"
      ></eagle-date>
      <eagle-date
        label="下次复审日期"
        required
        :date.sync="form.NextCheckDay"
      ></eagle-date>

      <div class="bottom-btns">
        <eagle-button type="primary" class="submit-btn" @click="save()">
          保存
        </eagle-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      id: this.$route.query.id,
      Code:'',
      userChooseDialogShow1: false,
      form: { Details: [] },
      show: false,
      plantypeShow: false,
      PlanTypeName:'',
      PlanType:'',

    };
  },


  created() {
    if (this.$route.query.id != null) {
      this.id = this.$route.query.id
      this.Code=this.$route.query.Code
    }
    if (this.id == 0) {
      var d = new Date();
      this.form.Year = d.getFullYear().toString();
      this.getInitEntity()
    }else{
      this.getDetail();
    }
  },
  methods: {
    getDetail() {
      let params = { id: this.id };
      this.$axios
        .get("/SiteCertCheckHis/GetDetail", {
          params: params,
        })
        .then((res) => {
          this.form = res.data;
        });
    },
    getInitEntity() {
      let params = { id: this.id ,Code:this.Code};
      this.$axios
        .get("/SiteCertCheckHis/InitEntity", {
          params: params,
        })
        .then((res) => {
          this.form = res.data;
        });
    },
    save() {
      this.$axios
        .post("/SiteCertCheckHis/Edit", this.form)
        .then((res) => {
          this.$toast.success("保存成功");
          setTimeout(() => {
            this.$router.goRefresh(-1);
          }, 300);
        });
    },
  },
};
</script>

<style lang="less" >
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.block {
  width: 120px;
  height: 120px;
  background-color: #fff;
}
</style>
<style lang="less" scoped>
.space-between {
  justify-content: space-between;
}
.bottom-btns {
  margin-top: 10px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .submit-btn {
    width: 100%;
    height: 35px;
    font-size: 14px;
  }
}
</style>
